Functions


Functions Summary
bool

cot_extension_add(string name, string title, string version, bool is_plug)

Registers an extension in the core

int

cot_extension_catcmp(array ext1, array ext2)

Compares 2 extension info entries by category code.

bool

cot_extension_dependencies_statisfied(string name, bool is_module, array selected_modules, array selected_plugins)

Checks if all dependencies for selected extension are satisfied.

bool

cot_extension_install(string name, bool is_module, bool update, bool force_update)

Installs or updates a Cotonti extension: module or plugin.

bool

cot_extension_installed(string name)

Checks if module is already installed

array

cot_extension_list_info(string dir)

Returns an array containing meta information for all extensions in a directory

bool

cot_extension_pause(string name)

Suspends (temporarily disables) a module

bool

cot_extension_remove(string name)

Unregisters a module from the core

bool

cot_extension_resume(string name)

Resumes a paused module

mixed

cot_extension_type(string name)

Returns installed extension type: 'module' if extension is a module, 'plug' if extension is a plugin or FALSE if extension is not installed.

void

cot_extension_uninstall(string name, bool is_module)

Uninstalls an extension and removes all its data

bool

cot_extension_update(string name, string version)

Updates module version number in the registry

array

cot_file_phpdoc(string filename)

Parses PHPDoc file header into an array

array

cot_infoget(string file, string limiter, int maxsize)

Extract info from COT file headers

int

cot_plugin_add(array hook_bindings, string name, string title, bool is_module)

Registers a plugin or module in hook registry Example: $hook_bindings = array( array( 'part' => 'rss', 'hook' => 'rss.main', 'order' => 20 ), array( 'part' => 'header', 'hook' => 'header.tags', ) ); cot_plugin_add($hook_bindings, 'test', 'Test plugin', false);

integer

cot_plugin_pause(string name, mixed part)

Suspends a plugin or one of its parts

int

cot_plugin_remove(string name, int binding_id)

Removes a plugin or one of its parts from hook registry

integer

cot_plugin_resume(string name, mixed part)

Resumes a suspended plugin or one of its parts

Function Detail

system\extensions.php at line 782

cot_extension_add

public bool cot_extension_add(string name, string title, string version, bool is_plug)
Registers an extension in the core
Parameters:
name - Extension name (code)
title - Title name
version - Version number as A.B.C
is_plug - Is a plugin
Returns:
TRUE on success, FALSE on error
Global:
CotDB $db

system\extensions.php at line 800

cot_extension_catcmp

public int cot_extension_catcmp(array ext1, array ext2)
Compares 2 extension info entries by category code. post-install extensions are always last.
Parameters:
ext1 - Ext info 1
ext2 - Ext info 2
Returns:

system\extensions.php at line 127

cot_extension_dependencies_statisfied

public bool cot_extension_dependencies_statisfied(string name, bool is_module, array selected_modules, array selected_plugins)
Checks if all dependencies for selected extension are satisfied. It means that either all required modules and plugins are already installed or selected for installation. Unsatisfied requirements messages are emitted with error & messaging API.
Parameters:
name - Extension code
is_module - TRUE for modules, FALSE for plugins
selected_modules - A list of modules currently in selection
selected_plugins - A list of plugins currently in selection
Returns:
TRUE if all dependencies are satisfied, or FALSE otherwise

system\extensions.php at line 187

cot_extension_install

public bool cot_extension_install(string name, bool is_module, bool update, bool force_update)
Installs or updates a Cotonti extension: module or plugin. Messages emitted during installation can be received through standard Cotonti messages interface.
Parameters:
name - Plugin code
is_module - TRUE for modules, FALSE for plugins
update - Perform update rather than new install
force_update - Forces extension update even if version has not changed
Returns:
Operation status
Global:
Cache $cache

system\extensions.php at line 836

cot_extension_installed

public bool cot_extension_installed(string name)
Checks if module is already installed
Parameters:
name - Module code
Returns:
Global:
CotDB $db

system\extensions.php at line 871

cot_extension_list_info

public array cot_extension_list_info(string dir)
Returns an array containing meta information for all extensions in a directory
Parameters:
dir - Directory to search for extensions in
Returns:
Extension code => info array

system\extensions.php at line 905

cot_extension_pause

public bool cot_extension_pause(string name)
Suspends (temporarily disables) a module
Parameters:
name - Module name
Returns:
Global:
CotDB $db

system\extensions.php at line 919

cot_extension_remove

public bool cot_extension_remove(string name)
Unregisters a module from the core
Parameters:
name - Module name
Returns:
Global:
CotDB $db

system\extensions.php at line 933

cot_extension_resume

public bool cot_extension_resume(string name)
Resumes a paused module
Parameters:
name - Module name
Returns:
Global:
CotDB $db

system\extensions.php at line 852

cot_extension_type

public mixed cot_extension_type(string name)
Returns installed extension type: 'module' if extension is a module, 'plug' if extension is a plugin or FALSE if extension is not installed.
Parameters:
name - Module code
Returns:
Global:
CotDB $db

system\extensions.php at line 577

cot_extension_uninstall

public void cot_extension_uninstall(string name, bool is_module)
Uninstalls an extension and removes all its data
Parameters:
name - Extension code
is_module - TRUE for modules, FALSE for plugins
Global:
CotDB $db
Cache $cache

system\extensions.php at line 948

cot_extension_update

public bool cot_extension_update(string name, string version)
Updates module version number in the registry
Parameters:
name - Module name
version - New version string
Returns:
Global:
CotDB $db

system\extensions.php at line 697

cot_file_phpdoc

public array cot_file_phpdoc(string filename)
Parses PHPDoc file header into an array
Parameters:
filename - Path to a PHP file
Returns:
Associative array containing PHPDoc contents. The array is empty if no PHPDoc was found

system\extensions.php at line 730

cot_infoget

public array cot_infoget(string file, string limiter, int maxsize)
Extract info from COT file headers
Parameters:
file - File path
limiter - Tag name
maxsize - Max header size
Returns:
Array containing block data or FALSE on error

system\extensions.php at line 982

cot_plugin_add

public int cot_plugin_add(array hook_bindings, string name, string title, bool is_module)
Registers a plugin or module in hook registry Example: $hook_bindings = array( array( 'part' => 'rss', 'hook' => 'rss.main', 'order' => 20 ), array( 'part' => 'header', 'hook' => 'header.tags', ) ); cot_plugin_add($hook_bindings, 'test', 'Test plugin', false);
Parameters:
hook_bindings - Hook binding map
name - Module or plugin name (code)
title - Module or plugin title
is_module - TRUE for modules, FALSE for plugins
Returns:
Number of records added
Global:
CotDB $db

system\extensions.php at line 1016

cot_plugin_pause

public integer cot_plugin_pause(string name, mixed part)
Suspends a plugin or one of its parts
Parameters:
name - Module or plugin name
part - ID of the binding to supsend or 0 to suspend all; if part name is passed, then that part is suspended
Returns:
Number of bindings suspended
Global:
CotDB $db

system\extensions.php at line 1041

cot_plugin_remove

public int cot_plugin_remove(string name, int binding_id)
Removes a plugin or one of its parts from hook registry
Parameters:
name - Module or plugin name
binding_id - ID of the binding to remove or 0 to remove all
Returns:
Number of bindings removed
Global:
CotDB $db

system\extensions.php at line 1062

cot_plugin_resume

public integer cot_plugin_resume(string name, mixed part)
Resumes a suspended plugin or one of its parts
Parameters:
name - Module or plugin name
part - ID of the binding to resume or 0 to resume all; if part name is passed, then that part is resumed
Returns:
Number of bindings suspended
Global:
CotDB $db